
*same graph, but comparing manipulative mediation with other mediation

use bsurvci_results.dta, clear

drop s_none*
	
*plot results for each stratum
local t=1
label var _t "Analysis time in days"
*label var s_none`t' "No mediation"	
label var s_nomanip`t' "Other mediation"	
label var s_manip`t' "Manipulative mediation"	
*label var s_nomanip`t' "Non-manipulative mediation"	
twoway 	///rarea s_none`t'_lb s_none`t'_ub _t if _t<3650, sort c(J J) lcol(gs10%30)  fcol(gs10%30) || 
	rarea s_manip`t'_lb s_manip`t'_ub _t if _t<3650, sort c(J J) lcol(gs10%30)  fcol(gs10%30)  || ///
	rarea s_nomanip`t'_lb s_nomanip`t'_ub _t if _t<3650, sort c(J J) lcol(gs10%30)  fcol(gs10%30) || ///
	line s_*`t' _t if _t<3650, c(J J J) lc(black black) lp(solid dash) ///
	legend(col(1) label(1 95%-CI) label(2 95%-CI) order(3 4) region(lwidth(none)) ) ///
	saving(strata`t', replace) t2title(`t' previous crises) sort 
graph export strata`t'.pdf, replace
forvalues t=2/5 {
	*label var s_none`t' "No mediation"	
	label var s_nomanip`t' "Other mediation"	
	label var s_manip`t' "Manipulative mediation"	
	*label var s_nomanip`t' "Non-manipulative mediation"	
	twoway 	///rarea s_none`t'_lb s_none`t'_ub _t if _t<3650, sort c(J J) col(gs10%30)  fcol(gs10%30) || 
		rarea s_manip`t'_lb s_manip`t'_ub _t if _t<3650, sort c(J J) col(gs10%30)  fcol(gs10%30)  || ///
		rarea s_nomanip`t'_lb s_nomanip`t'_ub _t if _t<3650, sort c(J J) lcol(gs10%30)  fcol(gs10%30) ||  ///
		line s_*`t' _t if _t<3650, c(J J J) lc(black black) lp(solid dash) ///
		legend(col(1) label(1 95%-CI) label(2 95%-CI) order(3 4) region(lwidth(none)) ) ///
		saving(strata`t', replace) t2title(`t' previous crises) sort
	graph export strata`t'.pdf, replace
}
grc1leg strata1.gph strata2.gph strata3.gph strata4.gph strata5.gph, ///
	ycommon row(3) leg(strata1.gph) saving(full2, replace) ///
	note(Note: Shaded areas depict 95% bootstrap CI.)
graph display, ysize(8)
graph export full_nomanip.pdf, replace
graph export full_nomanip.png, replace

clear

graph combine full.gph full2.gph, ///
	ycommon saving(combined, replace) 

